package com.situ.mall.controller.back;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.situ.mall.common.ServerResponse;
import com.situ.mall.entity.Category;
import com.situ.mall.entity.CategoryCount;
import com.situ.mall.service.ICategoryService;

@Controller
@RequestMapping("/category")
public class CategoryController {
	
	@Autowired
	private ICategoryService categoryService;
	
	@RequestMapping("/getCategoryListPage")
	private String getCategoryListPage() {
		return "category_list";
	}

	@RequestMapping("/pageList")
	@ResponseBody
	public ServerResponse pageList(Integer page, Integer limit, Category Category) {
		return categoryService.pageList(page, limit ,Category);
	}
	
	@RequestMapping("/selectTopCategory")
	@ResponseBody
	public ServerResponse selectTopCategory() {
		return categoryService.selectTopCategory();
	}
	
	@RequestMapping("/selectSecondCategory")
	@ResponseBody
	public ServerResponse selectSecondCategory(Integer topCategoryId) {
		return categoryService.selectSecondCategory(topCategoryId);
	}
	
	@RequestMapping("/getCategoryProductCountPage")
	public String getCategoryProductCountPage() {
		return "category_product_count";
	}
	
	
	@RequestMapping("/getCategoryProductCount")
	@ResponseBody
	public ServerResponse getCategoryProductCount() {
		return categoryService.getCategoryProductCount();
	}
	
}
